#if !defined(SLOT_PAGE_H)
#define SLOT_PAGE_H

#include <atlcrack.h>
#include "PropPage.h"
#include "WinUtil.h"
#include "../client/SettingsManager.h"

class SlotPage : public CPropertyPage<IDD_SLOTPAGE>, public PropPage
{
	public:
		SlotPage(SettingsManager *s) : PropPage(s)
		{
			title = _tcsdup((TSTRING(SETTINGS_UPLOADS) + _T('\\') + TSTRING(SLOTS)).c_str());
			SetTitle(title);
			m_psp.dwFlags |= PSP_RTLREADING;
		}
		virtual ~SlotPage()
		{
			free(title);
		}
		
		BEGIN_MSG_MAP_EX(SlotPage)
		MESSAGE_HANDLER(WM_INITDIALOG, onInitDialog)
		COMMAND_ID_HANDLER(IDC_EXTRA_SLOT_BY_IP, onFixControls)
		REFLECT_NOTIFICATIONS()
		END_MSG_MAP()
		
		LRESULT onInitDialog(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/);
		
		LRESULT onFixControls(WORD /*wNotifyCode*/, WORD /*wID*/, HWND /*hWndCtl*/, BOOL& /*bHandled*/)
		{
			fixControls();
			return 0;
		}

		// Common PropPage interface
		PROPSHEETPAGE *getPSP()
		{
			return (PROPSHEETPAGE *) * this;
		}
		virtual void write();
		
	protected:
		void fixControls();

		static Item items[];
		static TextItem texts[];
		TCHAR* title;
	private:
		string m_IPGrant;
		string m_IPGrantPATH;

};

#endif // !defined(SLOT_PAGE_H)
